/*
 *Created on 2005-11-11 
 */
package cn.com.pxto.commons.pagesupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.com.pxto.commons.propertiesutil.ConfigurationException;
import cn.com.pxto.commons.propertiesutil.Properties;

/**
 * ��ҳ��Ϣ��������
 * @author Gauss Cheung
 *
 */
public class PageInfoFactory {
	public static final int DefaultPageSize;
	static{
		int pageSize=10;//default pageSize is 10
		try {
			pageSize=Properties.getInstance().getIntValue("pagesize");
		} catch (ConfigurationException e) {
		}
		DefaultPageSize=pageSize;
	}
	private static Log log = LogFactory.getLog(PageInfoFactory.class);
	/**
	 * ָ����Ҫ�ľ���ҳ�룬ҳ�ߴ�ͨ��Properties���
	 * @param pageNo int
	 * @return PageInfo  
	 */
	public static PageInfo getPageInfo(int pageNo){
//extract default page size to const field,
//so that it can be accessed by MediaFileAction.Lu Guo Xiang
//		int pageSize = 10;
//		try{
//			pageSize = Properties.getInstance().getIntValue("pagesize");
//		}catch(Exception e){
//			log.warn("Get page size error use the default value:10");
//		}
		return new PageInfo(DefaultPageSize,pageNo);
	}
	/**
	 * ָ����Ҫ�ľ���ҳ���ҳ�ߴ�
	 * @param pageSize int
	 * @param pageNo int
	 * @return PageInfo
	 */
	public static PageInfo getPageInfo(int pageSize,int pageNo){
		return new PageInfo(pageSize,pageNo);
	}
}
